package com.ruoyi.nuclein.scheduled;

import com.ruoyi.nuclein.Feign.BasicDataFeign;
import com.ruoyi.nuclein.service.IMissionOvertimeService;
import com.ruoyi.nuclein.service.IMissionService;
import com.ruoyi.nuclein.service.IResidentmissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定时任务 之 核酸超时管理
 **/
@Component
public class Task{

    @Autowired
    private IMissionService missionService;

    @Autowired
    private IResidentmissionService residentmissionService;

    @Autowired
    private IMissionOvertimeService missionOvertimeService;

    @Autowired
    private BasicDataFeign basicDataFeign;

    /**
     *  核酸超时处理
     */
    @Scheduled(cron="0/30 * *  * * ? ")   //每5秒执行一次
//    @Scheduled(cron="0 0 12 * * ?")   //每天12点执行一次
//    @Scheduled(cron="0 */5 * * * ?") //每5分钟执行一次
    public void execute(){
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置日期格式
        System.out.println(df.format(new Date()));
        missionOvertimeService.overtime();
    }
}
